﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace QuocHoi_TV_Frontend.Models
{
    public static class NewsHelper
    {
        static public string Imgnews(string type)
        {
            try
            {
                string strRe = "";
                int inttype = int.Parse(type);
                if (inttype == 1)
                {
                    strRe = "<img border=\"0\" width=\"12\" height=\"9\" src=\"Images/pic.gif\" title=\"Tin ảnh\" alt=\"Tin ảnh\">";
                }
                else if (inttype == 2)
                {
                    strRe = "<img border=\"0\" width=\"12\" height=\"9\" src=\"Images/videos.gif\" title=\"Tin video\" alt=\"Tin video\">";
                }
                else if (inttype == 3)
                {
                    strRe = "<img border=\"0\" width=\"12\" height=\"9\" src=\"Images/audacity.png\" title=\"Tin video\" alt=\"Tin audio\">";
                }
                else
                {
                    strRe = "";
                }
                return strRe;
            }
            catch (Exception)
            {
                return "";
            }

        }

        static public string Sliptsubject(string Subject, int maxlenSubJect)
        {
            try
            {
                string Subject1;
                Subject1 = Subject.Trim();
                if ((Subject1.Length > maxlenSubJect) && (Subject1.Length > 0))
                {
                    Subject1 = Subject.Substring(0, maxlenSubJect) + "...";
                }
                return (Subject1);
            }
            catch (Exception)
            {
                return ""; 
            }
           
        }
       
    }
}